The subquery is a query within another query. The outer query is called as the main query, and the inner query is called subquery. The SubQuery is always executed first, and the result of the subquery is passed on to the main query.
The subquery is a SQL query within a query.
The subqueries are nested queries that provide data to the enclosing query.
The subqueries can return individual values or a list of records
The subqueries must be enclosed with parenthesis
Example:-
SELECT column_name
FROM table_name
WHERE column_name expression operator
( SELECT COLUMN_NAME from TABLE_NAME WHERE ... );
Select NAME, LOCATION, PHONE_NUMBER from DATABASE
WHERE ROLL_NO IN
(SELECT ROLL_NO from STUDENT where SECTION=’A’);
Liked By
Write Answer
What is subquery?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
04-Jul-2019The subquery is a query within another query. The outer query is called as the main query, and the inner query is called subquery. The SubQuery is always executed first, and the result of the subquery is passed on to the main query.